/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.txweb.table;

import com.jspx.sober.annotation.IDType;
import com.jspx.sober.annotation.Table;
import com.jspx.sober.annotation.Id;
import com.jspx.sober.annotation.Column;
import com.jspx.sober.table.OperateTable;
import com.jspx.utils.StringUtil;
import com.jspx.utils.DateUtil;
import java.util.Date;


/**
 * Created by IntelliJ IDEA.
 * User: 陈原
 * Date: 2007-10-6
 * Time: 15:07:36
 * 记录每天发布的数量
 */
@Table(name = "jspx_post_calendar", caption = "提交日历")
public class PostCalendar extends OperateTable
{
    public PostCalendar()
    {

    }

    @Id(auto = true,type= IDType.serial)
    @Column(caption="ID",notNull = true)
    private int id;

    @Column(caption = "计数", notNull = true)
    private long postCount = 0;

    @Column(caption = "最后日期", notNull = true)
    private Date postDate = new Date();

    @Column(caption = "字符串日期", length = 40, notNull = true)
    private String shortDate = DateUtil.toString(DateUtil.DAY_FORMAT);

    @Column(caption = "年份", length = 5, notNull = true)
    private int dateYear = DateUtil.getYear();

    @Column(caption = "月份", length = 3, notNull = true)
    private int dateMonth = DateUtil.getMonth();

    @Column(caption = "日", length = 3, notNull = true)
    private int dateDay = DateUtil.getDate();

    @Column(caption = "命名空间", length = 50, notNull = true)
    private String namespace = StringUtil.empty;

    private String hint = StringUtil.empty;

    private String cssName = StringUtil.empty;

    public long getPostCount()
    {
        return postCount;
    }

    public void setPostCount(long postCount)
    {
        this.postCount = postCount;
    }

    public int getDateYear()
    {
        return dateYear;
    }

    public void setDateYear(int dateYear)
    {
        this.dateYear = dateYear;
    }

    public int getDateDay()
    {
        return dateDay;
    }

    public void setDateDay(int dateDay)
    {
        this.dateDay = dateDay;
    }


    public String getCssName()
    {
        return cssName;
    }

    public void setCssName(String cssName)
    {
        this.cssName = cssName;
    }

    public String getHint()
    {
        return hint;
    }

    public void setHint(String hint)
    {
        this.hint = hint;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getPostDate()
    {
        return postDate;
    }

    public void setPostDate(Date postDate)
    {
        this.postDate = postDate;
        shortDate = DateUtil.toString(this.postDate,DateUtil.DAY_FORMAT);
        dateYear = StringUtil.toInt(DateUtil.toString(this.postDate,"yyyy"));
        dateMonth = StringUtil.toInt(DateUtil.toString(this.postDate,"MM"));
        dateDay = StringUtil.toInt(DateUtil.toString(this.postDate,"dd"));
    }

    public String getShortDate()
    {
        return shortDate;
    }

    public void setShortDate(String shortDate)
    {
        this.shortDate = shortDate;
    }

    public int getDateMonth()
    {
        return dateMonth;
    }

    public void setDateMonth(int dateMonth)
    {
        this.dateMonth = dateMonth;
    }

    public void updatePostDate()
    {
        setPostDate(postDate);
    }

    public String getNamespace()
    {
        return namespace;
    }

    public void setNamespace(String namespace)
    {
        this.namespace = namespace;
    }
}